package com.ticket.sass.ticketserver.business

import com.ticket.sass.common.ticketserver.dto.output.HallOutput
import com.ticket.sass.common.ticketserver.dto.output.ScheduleOutput
import com.ticket.sass.common.ticketserver.dto.output.ScheduleSeatMapOutput
import com.ticket.sass.ticketserver.dto.input.ScheduleInput
import com.ticket.sass.ticketserver.dto.input.ScheduleSeatMapInput
import com.ticket.sass.ticketserver.manager.TicketServerManager
import com.ticket.sass.common.ticketserver.dto.input.ScheduleInput as TicketServerScheduleInput
import com.ticket.sass.common.ticketserver.dto.input.ScheduleSeatMapInput as TicketServerScheduleSeatMapInput
import org.springframework.stereotype.Component


/**
 * @author 朱其鹏
 * @date 2024/3/20 18:08
 */
@Component
class BasicDataBusiness(
    private val ticketServerManager: TicketServerManager,
) {
    fun halls(): HallOutput {
        return ticketServerManager.api.halls()
    }

    fun schedules(input: ScheduleInput): ScheduleOutput {
        return ticketServerManager.api.schedules(TicketServerScheduleInput(input.startDate, input.endDate))
    }

    fun scheduleSeatMap(input: ScheduleSeatMapInput): ScheduleSeatMapOutput {
        return ticketServerManager.api.scheduleSeatMap(TicketServerScheduleSeatMapInput(
                input.sessionCode,
                input.scheduleKey,
                input.hallCode,
                input.seatVersion,
                input.updateTime,
            ))
    }
}